<?php
/*
 * Created on 2012-7-12
 *
 * @目的 处理登录
 * @param
 *
 */
class checklogin extends MY_Controller{
	function __construct(){
		parent::__construct();

	}
	function index(){
		$username = $this->input->post('username',true);
		$password = $this->input->post('password',true);
		$current = $this->input->post("current_url",true);
		$this->load->model('user_m');
		$true = $this->user_m->check_user(array('username'=>$username,'password'=>$password));
		if($true){
			$this->session->set_userdata(array('username'=>$username,'password'=>$password));
			if($current){
				redirect($current);
			}else{
				redirect(site_url());
			}
		}else{
			echo "false";
		}
	}
	function logout(){
		$this->session->unset_userdata(array('username'=>'','password'=>''));
		redirect(site_url());
	}
}
?>
